package Text_81;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Code {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new FileReader("E:\\A\\Memorial.txt"));
        String len;
        ArrayList<String> list = new ArrayList<>();
        while((len = br.readLine())!=null){
            list.add(len);
        }
        System.out.println(list);
        br.close();

        Collections.sort(list, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                int i1 = Integer.parseInt((o1.split("\\.")[0]));
                int i2 = Integer.parseInt((o2.split("\\.")[0]));
                return i1-i2;
            }
        });
       BufferedWriter bw = new BufferedWriter(new FileWriter("E:\\A\\MemorialCopy.txt"));
       int leng;
       for (String s : list){
           bw.write(s);
           bw.newLine();
       }
       bw.close();

	}

}
